/**
 * 
 */
package com.shop.repositories;

import java.util.List;

import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.shop.entities.Product;
import com.shop.mappers.ProductMapper;

/**
 * 
 *
 */
@Repository
public class ProductRepository {

	@Autowired
	private ProductMapper productMapper;

	public void addProduct(Product p) {
		productMapper.add(p);
	}

	public Product findProductById(Integer id) {

		return productMapper.findProductById(id);
	}

	public List<Product> findProductsByCategoryId(Integer id) {

		return productMapper.findProductsByCategoryId(id);

	}

	public List<Product> findAllProducts() {

		return productMapper.findAllProducts();
	
	}

	public void updateProduct(Product p) {
	
		productMapper.update(p);
	
	}
	
	public void deleteProduct(Product p) {
		
		productMapper.delete(p);
	
	}
	

}
